#ifndef USEFUL_METHOD_H
#define USEFUL_METHOD_H

#include "GL\glew.h"
#include <Windows.h>
#include <math.h>
#include <cstdlib>
#include <vector>
#include <assert.h>
#include "freeglut.h"
#include "glext.h"
#include "vector3.h"
#include "ball.h"
#include "FreeType.h"

const int ONE_MILE = 5280;
const int HALF_MILE = 5280/2;
const int BALL_RADIUS = 50;
const double MAX_ROTATION_DEGREES = 1.5;
const double PLUS_SIZE = 0.025;
const double WALL_HEIGHT = 2 * BALL_RADIUS;
//const int GOD_VIEW_WIDTH = 160;
//const int GOD_VIEW_HEIGHT = 100;
const int GOD_VIEW_SIDE = 300;

#define ILUT_USE_OPENGL		// This MUST be defined before calling the DevIL headers or we don't get OpenGL functionality
#include "IL\ilut.h"

using namespace std;
const float PI = 4.0f*(float)atan(1.0);

//picks a random float between min and max
float RangeRand(float min, float max);
//draw the coordinate axis
void drawAxis3(float len);
//takes a angle and a radius and gives you the length of x and z on the circle
void getXandZonCircleWithRandTheta(float theta, float radius, float &x, float &z);
float degreesToRadians(float degrees);
float radiansToDegrees(float radians);

Vector3 randUnitSphereVector();

string intToString(int number);

//This is the equation of the form at^2 + bt + c.  ansPlus is the answer when
//+ is used in the quadratic formula and minus is for minus.  If the answers
//are imaginary the method returns true and the answers are garbage.
bool quadraticEq(float a, float b, float c, float & ansPlus, float & ansMinus);

//does the same as their gl counterparts but has a vector input
void glVertexVector(Vector3 pos);
void glNormalVector(Vector3 norm);
void glColorVector(Vector3 color);
void glTranslateVector(Vector3 dis);

//if true game is paused
extern bool paused;
//if true wireframe mode is on
extern bool wireFrame;
//if true smooth shading is on
extern bool shadeModel;
//if true normals for complex ships are on
extern bool normals;
//the current mode you are in
extern int mode;
// FOR DEBUGGING
extern bool ballsOn;
//staring time of ball countdown
extern int startingTime;
//billards mode on/off
extern bool billardsOn;
//fireworks on/off
extern bool fireworksOn;

extern bool JumbotronMesh;

extern bool PhongShading;
extern bool ToonBalls;

extern bool Waving_Jumbotron;

extern bool Fog_Is_Active;

extern bool EarthBall;

// Hole in Floor
extern bool Hole_Is_Active;
extern bool player_in_hole;

// Instant Replay
extern bool Play_Instant_Replay;

// Window Dimensions
extern int window_width;
extern int window_height;

// Skybox number
extern int skybox_num;
#define NUM_SKYBOXES 3
extern bool rotateSkybox;

// Position of the camera
extern Vector3 camera;

// Holds all font info
extern freetype::font_data our_font;

// Global Display Lists
extern GLuint DisplayListIndex;
#define NUM_DISPLAY_LISTS 8
extern enum { DRAW_BALL, DRAW_WARP_ZONE, DRAW_HOLE, DRAW_COLUMNS, DRAW_WALL, DRAW_FLOOR, DRAW_PLAYER, DRAW_GLU_BALL };

extern bool warp_zone_active;

// Used to get the coordinates of the mouse when clicking on the screen
namespace Mouse
{
	static GLdouble winX, winY, winZ;
	static GLdouble posX, posY, posZ; 
	static GLint viewport[4];
	static GLdouble modelview[16];
	static GLdouble projection[16];
}

#endif